<template>
  <form-create v-model:api="fapi" :rule="rule" :option="option" @submit="onSubmit" />
</template>
<script setup lang="ts">
import formCreate from '@form-create/element-ui'

const fapi = ref(null)
const rule = ref<any>([])
const option = ref({})
const init = () => {
  rule.value = formCreate.parseJson(
    '[{"type":"DictSelect","field":"Fx91m8d67oywabc","title":"字典选择器","info":"","$required":true,"props":{"clearable":true,"dictType":"common_gender"},"_fc_id":"id_Fe3jm8d67oywabc","name":"ref_F72em8d67oywacc","display":true,"hidden":false,"_fc_drag_tag":"DictSelect"},{"type":"UserSelect","field":"Frxkm8d67r8uacc","title":"用户选择器","info":"","$required":true,"props":{"clearable":true,"multiple":true},"_fc_id":"id_F9ecm8d67r8uadc","name":"ref_Fk7tm8d67r8uaec","display":true,"hidden":false,"_fc_drag_tag":"UserSelect"},{"type":"DeptSelect","field":"Fsxim8d67skhadc","title":"部门选择器","info":"","$required":true,"props":{"clearable":true,"multiple":true},"_fc_id":"id_F5iqm8d67skhafc","name":"ref_Fq4lm8d67skhagc","display":true,"hidden":false,"_fc_drag_tag":"DeptSelect"}]'
  )
  option.value = formCreate.parseJson(
    '{"form":{"inline":false,"hideRequiredAsterisk":false,"labelPosition":"right","size":"default","labelWidth":"100px"},"resetBtn":{"show":false,"innerText":"重置"},"submitBtn":{"show":true,"innerText":"提交"}}'
  )
}
const onSubmit = (formData) => {
  //todo 提交表单
  console.log(JSON.stringify(formData))
}
init()
</script>
